AT-NFC  2.1 (win)
AT-NFC kernel set
Data Structures | Typedefs | Functions
HAL Crypto functions API

HAL crypto functions Interface. More...

Data Structures

struct  tag_HAL_CRYPT_PK
 Get PK info structure. More...
 
struct  tag_HAL_CRYPT_CERT_INFO
 Check certificate revocation cert info structure. More...
 

Typedefs

typedef struct tag_HAL_CRYPT_PK HAL_CRYPT_PK
 Get PK info structure.
 
typedef struct tag_HAL_CRYPT_CERT_INFO HAL_CRYPT_CERT_INFO
 Check certificate revocation cert info structure.
 

Functions

KER_INT16U hal_crypt_get_hash_len (KER_CTX_PARAM KER_BYTE btAlg)
 Returns HASH length by Hash ALG according to EMV Book 2, Appendix B3. More...
 
KER_BOOL hal_crypt_calc_hash (KER_CTX_PARAM KER_BYTE btAlg, KER_VOID *pExtra, const KER_BYTE *pbtDataBuffer, KER_INT16U usDataBufferLen, KER_BYTE *pbtHash, KER_INT16U *pusHashLen, KER_INT16U usHashSize)
 Calculates hash for data buffer provided. More...
 
KER_BOOL hal_crypt_calc_hash_init (KER_CTX_PARAM KER_BYTE btAlg, KER_VOID *pExtra, KER_VOID **ppHashHandle)
 Initiates hash calculation. More...
 
KER_BOOL hal_crypt_calc_hash_update (KER_CTX_PARAM KER_VOID *pHashHandle, KER_BYTE btAlg, const KER_BYTE *pbtDataBuffer, KER_INT16U usDataBufferLen)
 Passes data for hash calculation (can be executed several times) More...
 
KER_BOOL hal_crypt_calc_hash_complete (KER_CTX_PARAM KER_VOID *pHashHandle, KER_BYTE btAlg, KER_BYTE *pbtHash, KER_INT16U *pusHashLen, KER_INT16U usHashSize)
 Calculates hash on prev. provided data. More...
 
KER_BOOL hal_crypt_unpredict_num_calc (KER_CTX_PARAM KER_INT16U usUnpredNumLen, KER_BYTE *pbtUnpredNum)
 Calculates unpredictable number. More...
 
KER_BOOL hal_crypt_unpredict_num_set_ac (KER_CTX_PARAM const KER_BYTE *pbtAc, KER_INT16U usAcLen)
 Updates unpredictable (random) number calculator with last AC (9F26) value (only if it was obtained from card) More...
 
KER_BOOL hal_crypt_encrypt (KER_CTX_PARAM KER_BYTE btAlg, const KER_BYTE *pbtKey, KER_INT16U usKeyLen, const KER_BYTE *pbtIV, KER_INT16U usIVLen, const KER_BYTE *pbtData, KER_INT16U usDataLen, KER_BYTE *pbtResult, KER_INT16U *pusResultLen, KER_INT16U usMaxLen)
 Performs encryption. More...
 
KER_BOOL hal_crypt_decrypt (KER_CTX_PARAM KER_BYTE btAlg, const KER_BYTE *pbtKey, KER_INT16U usKeyLen, const KER_BYTE *pbtIV, KER_INT16U usIVLen, const KER_BYTE *pbtEncryptedData, KER_INT16U usEncryptedDataLen, KER_BYTE *pbtResult, KER_INT16U *pusResultLen, KER_INT16U usMaxLen)
 Performs decryption. More...
 
KER_BOOL hal_crypt_get_ca_pk (KER_CTX_PARAM KER_BYTE btKernelID, const KER_BYTE *pbtRID, KER_BYTE btRIDLen, KER_BYTE btKeyIndex, HAL_CRYPT_PK *pCA_PK)
 Get CA PK by index from repositoty. More...
 
KER_BOOL hal_crypt_msg_recovery (KER_CTX_PARAM const KER_BYTE *pbtPK, KER_INT16U usPKLen, const KER_BYTE *pbtExp, KER_INT16U usExpLen, KER_BYTE btAlg, const KER_BYTE *pbtMsg, KER_INT16U usMsgLen, KER_BYTE *pbtResult, KER_INT16U *pusResultLen, KER_INT16U usMaxLen)
 Message recovery according to EMV Book 2, Appendix A2.1. More...
 
KER_BOOL hal_crypt_check_cert_revocation (KER_CTX_PARAM KER_BYTE btKernelID, const KER_BYTE *pbtRID, KER_BYTE btRIDLen, KER_BYTE btKeyIndex, const HAL_CRYPT_CERT_INFO *pCert)
 Checks certificate against certificatye revocation list. More...
 
KER_BOOL hal_crypt_check_ecc_cert_revocation (KER_CTX_PARAM KER_BYTE btKernelID, const KER_BYTE *pbtRID, KER_BYTE btRIDLen, KER_BYTE btKeyIndex, const HAL_CRYPT_CERT_INFO *pCert)
 Checks ECC certificate against certificatye revocation list. More...
 
KER_INT16U hal_ecc_get_sign_len (KER_CTX_PARAM KER_BYTE btASI)
 Returns ECC message signature length by ASI according to EMV Book 2, Appendix B2.4.1. More...
 
KER_INT16U hal_ecc_get_pk_len (KER_CTX_PARAM KER_BYTE btASI)
 Returns ECC PK length by ASI according to EMV Book 2, Appendix B2.4.1. More...
 
KER_BOOL hal_ecc_msg_sign_check (KER_CTX_PARAM KER_BYTE btASI, const KER_BYTE *pbtPK, KER_INT16U usPKLen, const KER_BYTE *pbtMsg, KER_INT16U usMsgLen, const KER_BYTE *pbtSignature, KER_INT16U usSignatureLen)
 ECC message signature check according to EMV Book 2, Appendix A2.2.3. More...
 
KER_BOOL hal_ecc_pk_check (KER_CTX_PARAM KER_BYTE btASI, const KER_BYTE *pbtPK, KER_INT16U usPKLen)
 ECC pk check Recover the y-coordinate EMV Book 2, Appendix B2.2.1e. More...
 
KER_BOOL hal_ecc_msg_sign_check_init (KER_CTX_PARAM KER_BYTE btASI, const KER_BYTE *pbtPK, KER_INT16U usPKLen, const KER_BYTE *pbtSignature, KER_INT16U usSignatureLen, KER_VOID **ppCheckHandle)
 ECC message signature check according to EMV Book 2, Appendix A2.2.3 (Initiates check) More...
 
KER_BOOL hal_ecc_msg_sign_check_update (KER_CTX_PARAM KER_VOID *pCheckHandle, const KER_BYTE *pbtMsg, KER_INT16U usMsgLen)
 ECC message signature check according to EMV Book 2, Appendix A2.2.3 (Update wuth MSG data) More...
 
KER_BOOL hal_ecc_msg_sign_check_complete (KER_CTX_PARAM KER_VOID *pCheckHandle, KER_BYTE btASI, const KER_BYTE *pbtPK, KER_INT16U usPKLen, const KER_BYTE *pbtSignature, KER_INT16U usSignatureLen)
 ECC message signature check according to EMV Book 2, Appendix A2.2.3 (Completes check) More...
 
#define KER_HASH_ALG_TC_HASH   0
 
#define KER_HASH_ALG_SHA1   1
 
#define KER_HASH_ALG_SHA256   2
 
#define KER_HASH_ALG_SHA512   3
 
#define KER_HASH_ALG_SHA3_256   4
 
#define KER_HASH_ALG_SHA3_512   5
 
#define KER_HASH_ALG_SM3   6
 
#define KER_CRYPT_ALG_DES   0
 
#define KER_CRYPT_ALG_AES   10
 
#define KER_CA_PK_SCHEME_NA   0
 
#define KER_CA_PK_SCHEME_RSA   1
 
#define KER_CA_PK_SCHEME_ECC   2
 
#define KER_REC_ALG_RSA_EMV   1
 
#define KER_HASH_SHA1_LEN   20
 
#define KER_HASH_SHA256_LEN   32
 
#define KER_HASH_SHA512_LEN   64
 
#define KER_HASH_SHA3_256_LEN   32
 
#define KER_HASH_SHA3_512_LEN   64
 
#define KER_HASH_SM3_LEN   32
 
#define KER_PK_MODULUS_LEN   248
 
#define KER_PK_EXP_LEN   3
 
#define KER_PK_HASH_LEN   20
 
#define KER_ECC_PK_P256_LEN   32
 
#define KER_ECC_PK_P521_LEN   66
 
#define KER_ECC_ASI_EC_SDSA_SHA256_P256   1
 
#define KER_ECC_ASI_EC_SDSA_SHA512_P521   2
 
#define KER_ECC_ASI_EC_SDSA_SHA3_256_P256   3
 
#define KER_ECC_ASI_EC_SDSA_SHA3_512_P521   4
 
#define KER_ECC_ASI_SM2_DSA_SM3_SM2_P256   5
 
#define KER_ECC_ASI_ODE_DH_EtM_AES_P256   20
 
#define KER_ECC_ASI_ODE_DH_EtM_AES_P521   21
 
#define KER_ECC_ASI_ODE_DH_EtM_SM4_SM2_P256   22
 

Detailed Description

HAL crypto functions Interface.

This functions should be implemented by terminal application

Macro Definition Documentation

◆ KER_CA_PK_SCHEME_ECC

#define KER_CA_PK_SCHEME_ECC   2

ECC

◆ KER_CA_PK_SCHEME_NA

#define KER_CA_PK_SCHEME_NA   0

N/A

◆ KER_CA_PK_SCHEME_RSA

#define KER_CA_PK_SCHEME_RSA   1

RSA

◆ KER_CRYPT_ALG_AES

#define KER_CRYPT_ALG_AES   10

Standard AES encryption (AES ECB)

◆ KER_CRYPT_ALG_DES

#define KER_CRYPT_ALG_DES   0

Standard DES encryption (DES ECB)

◆ KER_ECC_ASI_EC_SDSA_SHA256_P256

#define KER_ECC_ASI_EC_SDSA_SHA256_P256   1

ECC Algorithm Suite Indicator 10, EMV Book 2 Annex B2.4.1

◆ KER_ECC_ASI_EC_SDSA_SHA3_256_P256

#define KER_ECC_ASI_EC_SDSA_SHA3_256_P256   3

ECC Algorithm Suite Indicator 12, EMV Book 2 Annex B2.4.1

◆ KER_ECC_ASI_EC_SDSA_SHA3_512_P521

#define KER_ECC_ASI_EC_SDSA_SHA3_512_P521   4

ECC Algorithm Suite Indicator 13, EMV Book 2 Annex B2.4.1

◆ KER_ECC_ASI_EC_SDSA_SHA512_P521

#define KER_ECC_ASI_EC_SDSA_SHA512_P521   2

ECC Algorithm Suite Indicator 11, EMV Book 2 Annex B2.4.1

◆ KER_ECC_ASI_ODE_DH_EtM_AES_P256

#define KER_ECC_ASI_ODE_DH_EtM_AES_P256   20

ODE Algorithm Suite Indicator 00, EMV Book 2 Annex B2.4.2

◆ KER_ECC_ASI_ODE_DH_EtM_AES_P521

#define KER_ECC_ASI_ODE_DH_EtM_AES_P521   21

ODE Algorithm Suite Indicator 01, EMV Book 2 Annex B2.4.2

◆ KER_ECC_ASI_ODE_DH_EtM_SM4_SM2_P256

#define KER_ECC_ASI_ODE_DH_EtM_SM4_SM2_P256   22

ODE Algorithm Suite Indicator 88, EMV Book 2 Annex B2.4.2

◆ KER_ECC_ASI_SM2_DSA_SM3_SM2_P256

#define KER_ECC_ASI_SM2_DSA_SM3_SM2_P256   5

ECC Algorithm Suite Indicator 80, EMV Book 2 Annex B2.4.1

◆ KER_ECC_PK_P256_LEN

#define KER_ECC_PK_P256_LEN   32

ECC P-256 Nfield EMV Book 2 Annex B2.2.2 (32 bytes)

◆ KER_ECC_PK_P521_LEN

#define KER_ECC_PK_P521_LEN   66

ECC P-256 Nfield EMV Book 2 Annex B2.2.2 (32 bytes)

◆ KER_HASH_ALG_SHA1

#define KER_HASH_ALG_SHA1   1

SHA-1 hash for CDA

◆ KER_HASH_ALG_SHA256

#define KER_HASH_ALG_SHA256   2

SHA-256 hash for XDA

◆ KER_HASH_ALG_SHA3_256

#define KER_HASH_ALG_SHA3_256   4

SHA-3 256 hash for XDA

◆ KER_HASH_ALG_SHA3_512

#define KER_HASH_ALG_SHA3_512   5

SHA-3 512 hash for XDA

◆ KER_HASH_ALG_SHA512

#define KER_HASH_ALG_SHA512   3

SHA-512 hash for XDA

◆ KER_HASH_ALG_SM3

#define KER_HASH_ALG_SM3   6

SM3 hash for XDA

◆ KER_HASH_ALG_TC_HASH

#define KER_HASH_ALG_TC_HASH   0

20 bytes hash for tag 98

◆ KER_HASH_SHA1_LEN

#define KER_HASH_SHA1_LEN   20

SHA-1 hash length

◆ KER_HASH_SHA256_LEN

#define KER_HASH_SHA256_LEN   32

SHA-256 hash length

◆ KER_HASH_SHA3_256_LEN

#define KER_HASH_SHA3_256_LEN   32

SHA-3-256 hash length

◆ KER_HASH_SHA3_512_LEN

#define KER_HASH_SHA3_512_LEN   64

SHA-3-512 hash length

◆ KER_HASH_SHA512_LEN

#define KER_HASH_SHA512_LEN   64

SHA-512 hash length

◆ KER_HASH_SM3_LEN

#define KER_HASH_SM3_LEN   32

SM3 hash length

◆ KER_PK_EXP_LEN

#define KER_PK_EXP_LEN   3

PK exponent EMV Book 2, 5.1 (3 bytes)

◆ KER_PK_HASH_LEN

#define KER_PK_HASH_LEN   20

PK hash (20 bytes)

◆ KER_PK_MODULUS_LEN

#define KER_PK_MODULUS_LEN   248

PK modulus EMV Book 2, 5.1 (248 bytes)

◆ KER_REC_ALG_RSA_EMV

#define KER_REC_ALG_RSA_EMV   1

MSG Recovery by RSA, EMV Book 2 Annex A2.1

Function Documentation

◆ hal_crypt_calc_hash()

KER_BOOL hal_crypt_calc_hash ( KER_CTX_PARAM KER_BYTE  btAlg,
KER_VOID pExtra,
const KER_BYTE pbtDataBuffer,
KER_INT16U  usDataBufferLen,
KER_BYTE pbtHash,
KER_INT16U pusHashLen,
KER_INT16U  usHashSize 
)

Calculates hash for data buffer provided.

Parameters
[in]btAlgHash algorithm to calculate (KER_HASH_ALG_TC_HASH KER_HASH_ALG_SHA1 KER_HASH_ALG_SHA1 , etc..)
[in]pExtraExtra param, reserved
[in]pbtDataBufferData buffer to hash
[in]usDataBufferLenLength of pbtDataBuffer
[out]pbtHashBuffer to obtain hash
[out]pusHashLenLength of pbtHash
[in]usHashSizeSize of pbtHash
Returns
KER_TRUE Success.
KER_FALSE Failure.

◆ hal_crypt_calc_hash_complete()

KER_BOOL hal_crypt_calc_hash_complete ( KER_CTX_PARAM KER_VOID pHashHandle,
KER_BYTE  btAlg,
KER_BYTE pbtHash,
KER_INT16U pusHashLen,
KER_INT16U  usHashSize 
)

Calculates hash on prev. provided data.

Parameters
[in]pHashHandlehash handle, obtained by hal_crypt_calc_hash_init (not valid after completion)
[in]btAlgHash algorithm to calculate (KER_HASH_ALG_TC_HASH KER_HASH_ALG_SHA1 KER_HASH_ALG_SHA1 , etc..)
[out]pbtHashBuffer to obtain hash
[out]pusHashLenLength of pbtHash
[in]usHashSizeSize of pbtHash
Returns
KER_TRUE Success.
KER_FALSE Failure.

◆ hal_crypt_calc_hash_init()

KER_BOOL hal_crypt_calc_hash_init ( KER_CTX_PARAM KER_BYTE  btAlg,
KER_VOID pExtra,
KER_VOID **  ppHashHandle 
)

Initiates hash calculation.

Parameters
[in]btAlgHash algorithm to calculate (KER_HASH_ALG_TC_HASH KER_HASH_ALG_SHA1 KER_HASH_ALG_SHA1 , etc..)
[in]pExtraExtra param, reserved
[out]ppHashHandleBuffer to obtain hash handle
Returns
KER_TRUE Success.
KER_FALSE Failure.

◆ hal_crypt_calc_hash_update()

KER_BOOL hal_crypt_calc_hash_update ( KER_CTX_PARAM KER_VOID pHashHandle,
KER_BYTE  btAlg,
const KER_BYTE pbtDataBuffer,
KER_INT16U  usDataBufferLen 
)

Passes data for hash calculation (can be executed several times)

Parameters
[in]pHashHandlehash handle, obtained by hal_crypt_calc_hash_init
[in]btAlgHash algorithm to calculate (KER_HASH_ALG_TC_HASH KER_HASH_ALG_SHA1 KER_HASH_ALG_SHA1 , etc..)
[in]pbtDataBufferBuffer to add for hash
[in]usDataBufferLenLength of pbtDataBuffer
Returns
KER_TRUE Success.
KER_FALSE Failure.

◆ hal_crypt_check_cert_revocation()

KER_BOOL hal_crypt_check_cert_revocation ( KER_CTX_PARAM KER_BYTE  btKernelID,
const KER_BYTE pbtRID,
KER_BYTE  btRIDLen,
KER_BYTE  btKeyIndex,
const HAL_CRYPT_CERT_INFO pCert 
)

Checks certificate against certificatye revocation list.

Use for CDA

Parameters
[in]btKernelIDKernel id (reserved)
[in]pbtRIDKernel RID
[in]btRIDLenLength of pbtRID
[in]btKeyIndexrequested key index
[in]pCertcertificate to check info
Returns
KER_TRUE Success.
KER_FALSE Failure (certificate revoked or invalid params).

◆ hal_crypt_check_ecc_cert_revocation()

KER_BOOL hal_crypt_check_ecc_cert_revocation ( KER_CTX_PARAM KER_BYTE  btKernelID,
const KER_BYTE pbtRID,
KER_BYTE  btRIDLen,
KER_BYTE  btKeyIndex,
const HAL_CRYPT_CERT_INFO pCert 
)

Checks ECC certificate against certificatye revocation list.

Use for CDA

Parameters
[in]btKernelIDKernel id (reserved)
[in]pbtRIDKernel RID
[in]btRIDLenLength of pbtRID
[in]btKeyIndexrequested key index
[in]pCertcertificate to check info
Returns
KER_TRUE Success.
KER_FALSE Failure (certificate revoked or invalid params).

◆ hal_crypt_decrypt()

KER_BOOL hal_crypt_decrypt ( KER_CTX_PARAM KER_BYTE  btAlg,
const KER_BYTE pbtKey,
KER_INT16U  usKeyLen,
const KER_BYTE pbtIV,
KER_INT16U  usIVLen,
const KER_BYTE pbtEncryptedData,
KER_INT16U  usEncryptedDataLen,
KER_BYTE pbtResult,
KER_INT16U pusResultLen,
KER_INT16U  usMaxLen 
)

Performs decryption.

Use for DES/AES encryption in MC IDS write functionality

Parameters
[in]btAlgencryption algorithm id (KER_CRYPT_ALG_DES KER_CRYPT_ALG_AES)
[in]pbtKeyEncryption key
[in]usKeyLenpbtKey buffer length
[in]pbtIVInitial Vector (set KER_NULL if not used)
[in]usIVLenpbtIV buffer length (set 0 if not used)
[in]pbtEncryptedDataData to encrypt
[in]usEncryptedDataLenpbtEncryptedData buffer length
[out]pbtResultbuffer to obtain decryption result
[out]pusResultLenbuffer to obtain decryption result length (with padding, if provided)
[in]usMaxLen- pbtResult buffer length
Returns
KER_TRUE Success.
KER_FALSE Failure.

◆ hal_crypt_encrypt()

KER_BOOL hal_crypt_encrypt ( KER_CTX_PARAM KER_BYTE  btAlg,
const KER_BYTE pbtKey,
KER_INT16U  usKeyLen,
const KER_BYTE pbtIV,
KER_INT16U  usIVLen,
const KER_BYTE pbtData,
KER_INT16U  usDataLen,
KER_BYTE pbtResult,
KER_INT16U pusResultLen,
KER_INT16U  usMaxLen 
)

Performs encryption.

Use for DES/AES encryption in MC IDS write functionality

Parameters
[in]btAlgencryption algorithm id (KER_CRYPT_ALG_DES KER_CRYPT_ALG_AES)
[in]pbtKeyEncryption key
[in]usKeyLenpbtKey buffer length
[in]pbtIVInitial Vector (set KER_NULL if not used)
[in]usIVLenpbtIV buffer length (set 0 if not used)
[in]pbtDataData to encrypt
[in]usDataLenpbtData buffer length (with nesessary padding)
[out]pbtResultbuffer to obtain encryption result
[out]pusResultLenbuffer to obtain encryption result length
[in]usMaxLen- pbtResult buffer length
Returns
KER_TRUE Success.
KER_FALSE Failure.

◆ hal_crypt_get_ca_pk()

KER_BOOL hal_crypt_get_ca_pk ( KER_CTX_PARAM KER_BYTE  btKernelID,
const KER_BYTE pbtRID,
KER_BYTE  btRIDLen,
KER_BYTE  btKeyIndex,
HAL_CRYPT_PK pCA_PK 
)

Get CA PK by index from repositoty.

Use for ODA/ODE

Parameters
[in]btKernelIDKernel id (reserved)
[in]pbtRIDKernel RID
[in]btRIDLenLength of pbtRID
[in]btKeyIndexrequested key index
[out]pCA_PKrequested CA PKs (size should be filled with sizeof struct)
Returns
KER_TRUE Success.
KER_FALSE Failure.

◆ hal_crypt_get_hash_len()

KER_INT16U hal_crypt_get_hash_len ( KER_CTX_PARAM KER_BYTE  btAlg)

Returns HASH length by Hash ALG according to EMV Book 2, Appendix B3.

Use for XDA

Parameters
[in]btAlgHash algorithm (KER_HASH_ALG_TC_HASH KER_HASH_ALG_SHA1 KER_HASH_ALG_SHA1 , etc..)
Returns
Hash length for provided hash alg.

◆ hal_crypt_msg_recovery()

KER_BOOL hal_crypt_msg_recovery ( KER_CTX_PARAM const KER_BYTE pbtPK,
KER_INT16U  usPKLen,
const KER_BYTE pbtExp,
KER_INT16U  usExpLen,
KER_BYTE  btAlg,
const KER_BYTE pbtMsg,
KER_INT16U  usMsgLen,
KER_BYTE pbtResult,
KER_INT16U pusResultLen,
KER_INT16U  usMaxLen 
)

Message recovery according to EMV Book 2, Appendix A2.1.

Use for CDA

Parameters
[in]pbtPKPublic Key for message recovery
[in]usPKLenpbtPK length
[in]pbtExpExponent of pbtPK
[in]usExpLenpbtExp length
[in]btAlgrecovery alg ID
[in]pbtMsgmessage to recovery
[in]usMsgLenpbtMsg length
[out]pbtResultbuffer to obtain recovered result
[out]pusResultLenvalue to obtain recovered result length
[in]usMaxLenpbtResult buffer size
Returns
KER_TRUE Success.
KER_FALSE Failure.

◆ hal_crypt_unpredict_num_calc()

KER_BOOL hal_crypt_unpredict_num_calc ( KER_CTX_PARAM KER_INT16U  usUnpredNumLen,
KER_BYTE pbtUnpredNum 
)

Calculates unpredictable number.

Parameters
[in]usUnpredNumLenLength of unpredictable (random) number required
[out]pbtUnpredNumBuffer to obtain unpredictable (random) number
Returns
KER_TRUE Success.
KER_FALSE Failure.

◆ hal_crypt_unpredict_num_set_ac()

KER_BOOL hal_crypt_unpredict_num_set_ac ( KER_CTX_PARAM const KER_BYTE pbtAc,
KER_INT16U  usAcLen 
)

Updates unpredictable (random) number calculator with last AC (9F26) value (only if it was obtained from card)

Use for unpredictable (random) number calculation algorithm described in: Specification Bulletin No. 144, First Edition June 2014, Terminal Unpredictable Number generation

Parameters
[in]pbtAcBuffer with AC value
[in]usAcLenLength of pbtAc
Returns
KER_TRUE Success.
KER_FALSE Failure.

◆ hal_ecc_get_pk_len()

KER_INT16U hal_ecc_get_pk_len ( KER_CTX_PARAM KER_BYTE  btASI)

Returns ECC PK length by ASI according to EMV Book 2, Appendix B2.4.1.

Use for XDA

Parameters
[in]btASIECC Algorithm Suite Indicator
Returns
ECC PK length.

◆ hal_ecc_get_sign_len()

KER_INT16U hal_ecc_get_sign_len ( KER_CTX_PARAM KER_BYTE  btASI)

Returns ECC message signature length by ASI according to EMV Book 2, Appendix B2.4.1.

Use for XDA

Parameters
[in]btASIECC Algorithm Suite Indicator
Returns
ECC message signature length.

◆ hal_ecc_msg_sign_check()

KER_BOOL hal_ecc_msg_sign_check ( KER_CTX_PARAM KER_BYTE  btASI,
const KER_BYTE pbtPK,
KER_INT16U  usPKLen,
const KER_BYTE pbtMsg,
KER_INT16U  usMsgLen,
const KER_BYTE pbtSignature,
KER_INT16U  usSignatureLen 
)

ECC message signature check according to EMV Book 2, Appendix A2.2.3.

Use for XDA

Parameters
[in]btASIECC Algorithm Suite Indicator
[in]pbtPKPublic Key for signature check
[in]usPKLenpbtPK length
[in]pbtMsgMessage to check
[in]usMsgLenpbtMsg length
[in]pbtSignatureSignature to check
[in]usSignatureLenpbtExp length
Returns
KER_TRUE Success.
KER_FALSE Failure.

◆ hal_ecc_msg_sign_check_complete()

KER_BOOL hal_ecc_msg_sign_check_complete ( KER_CTX_PARAM KER_VOID pCheckHandle,
KER_BYTE  btASI,
const KER_BYTE pbtPK,
KER_INT16U  usPKLen,
const KER_BYTE pbtSignature,
KER_INT16U  usSignatureLen 
)

ECC message signature check according to EMV Book 2, Appendix A2.2.3 (Completes check)

Use for XDA

Parameters
[in]pCheckHandlehash handle, obtained by hal_ecc_msg_sign_check_init (not valid after completion)
[in]btASIECC Algorithm Suite Indicator
[in]pbtPKPublic Key for signature check
[in]usPKLenpbtPK length
[in]pbtSignatureSignature to check
[in]usSignatureLenpbtExp length
Returns
KER_TRUE Success.
KER_FALSE Failure.

◆ hal_ecc_msg_sign_check_init()

KER_BOOL hal_ecc_msg_sign_check_init ( KER_CTX_PARAM KER_BYTE  btASI,
const KER_BYTE pbtPK,
KER_INT16U  usPKLen,
const KER_BYTE pbtSignature,
KER_INT16U  usSignatureLen,
KER_VOID **  ppCheckHandle 
)

ECC message signature check according to EMV Book 2, Appendix A2.2.3 (Initiates check)

Use for XDA

Parameters
[in]btASIECC Algorithm Suite Indicator
[in]pbtPKPublic Key for signature check
[in]usPKLenpbtPK length
[in]pbtSignatureSignature to check
[in]usSignatureLenpbtExp length
[out]ppCheckHandleBuffer to obtain check handle
Returns
KER_TRUE Success.
KER_FALSE Failure.

◆ hal_ecc_msg_sign_check_update()

KER_BOOL hal_ecc_msg_sign_check_update ( KER_CTX_PARAM KER_VOID pCheckHandle,
const KER_BYTE pbtMsg,
KER_INT16U  usMsgLen 
)

ECC message signature check according to EMV Book 2, Appendix A2.2.3 (Update wuth MSG data)

Use for XDA

Parameters
[in]pCheckHandlehash handle, obtained by hal_ecc_msg_sign_check_init
[in]pbtMsgMessage (or part of Message) to add to check
[in]usMsgLenpbtMsg length
Returns
KER_TRUE Success.
KER_FALSE Failure.

◆ hal_ecc_pk_check()

KER_BOOL hal_ecc_pk_check ( KER_CTX_PARAM KER_BYTE  btASI,
const KER_BYTE pbtPK,
KER_INT16U  usPKLen 
)

ECC pk check Recover the y-coordinate EMV Book 2, Appendix B2.2.1e.

Use for XDA

Parameters
[in]btASIECC Algorithm Suite Indicator
[in]pbtPKPublic Key for signature check
[in]usPKLenpbtPK length
Returns
KER_TRUE Success.
KER_FALSE Failure.